# Drive Snapshot - VSS

Drive Snapshot offers the possibility to use the Windows build in Volume Snapshot Copy Service (VSS) for the creation of consistent images.

Main advantage compared to the internal Drive Snapshot Driver is the ability to image a running MS Exchange server, and also to image several partitions at the same time.
(See below for technical Details).

### Usage

By using VSS, several drives can be imaged at the same time:

- from the GUI by holding the Control key while clicking in the list

- from the command line with
  c:>snapshot c:+d:+e: x:\backup\computer\$DISK-FULL.sna

- if saving several disks at the same time, the destination MUST contain $DISK somewhere to differentiate the different image files

- differential Images
  c:>snapshot c:+d:+e: x:\computer\$DISK-$DATE-Diff.sna -hx:\backup\computer\$DISK-FULL.hsh
  works only from the command line

- snapshot hd1:* x:\backup\$disk.sna
  saves all partitions of physical drive 1, incl.
  Linux, Dell, Compaq,...

### Technical Details

Since Windows XP Windows implements a 'Volume ShadowCopy Service' (VSS), that essentially provides the same service as the build in Snapshot driver - that is a consistent snapshot of one (or more) partitions at a fixed point in time.
Additionally, it defines and implements a broadcast similar to:

> To everybody who cares about VSS: would you please go into a consistent state, bring transactions to a recoverable state, etc., and than please be write for some (short) time because I'm going to make a backup.

At this time, the current state of the disk is frozen, and made available for backup programs until.
Changes to the drive while the backup is active are written to some reserved space on the disk, until the backup finishes and tells VSS to release the buffers.

VSS advantages

- Can snapshot several volumes at the same time

- By using above mentioned broadcast it can also put Exchange Server 2003 into a stable state without shutting down exchange services, which isn't always reliable possible without using VSS.
  For other databases this isn't necessary (they seem to be implemented in a more stable fashion), but at least using VSS doesn't hurt.

VSS disadvantages

- by the fixed (preconfigured) size of the VSS buffers, at least in theory this buffer can overflow, and thus abort the backup.
  the build in driver writes changes immediately to the image, and thus can't overflow.

- by the additional buffering on disk, using VSS may be slower then the internal driver.

- VSS doesn't exist for Windows NT and Windows 2000.

- VSS simply doesn't work, if some older products (like older version of MS SQL) are running on more recent windows versions; NTBACKUP doesn't work in these cases either.

Implementation of VSS vs.
internal driver

As both drivers have their pros and cons, by default the VSS driver is only used if

- MS Exchange 2003 or Active Directory are detected

- a backup of several volumes is started

else the internal driver is used.
You may change this by using the [Advanced Options] dialog, or from command line by

- --noVSS: never uses VSS

- --UseVSS: always uses VSS, if it exists and works

- --ForceVSS: tries to use VSS; if VSS is not available for some reason, backup is aborted with error

## Using Volume Shadow Copy Service (VSS) with and without explicit usage of writers

The Volume Shadow Copy Service (VSS) of Windows has been available since Windows XP/2003.
It can be used by application to create a shadow copy of one or more partitions.
The components that communicate with the VSS are called VSS writer.
You can before and after a backup perform actions.
A list of the available system writers can obtained by the command:

vssadmin list writers

Snapshot can use VSS in two different modes.

### VSS without explicit usage of writers

- Creates a shadow copy, that contains a konsistent copy of all existing data.
- Snapshot uses this mode automatically if more then one partition is selected, or MS Exchange is detected.
  (in Windows SBS2003 the necessary Exchange writer is disabled by default, and must be enabled; see http://support.microsoft.com/kb/838183)
- writers are not used in an explicit way, and no specific actions are taken.
- Transaction logs on an Exchange server will not be truncated after the backup, and a Hyper-V host does not notify the virtual machines running on the scheduled backup.

### VSS with and without explicit usage of writers

- Snapshot uses this mode only if instructed (Advanced Backup Options dialog).
  In this mode all started VSS writers are notified about the starting backup, and can go ahead and carry out special operations.
  They are also notified about successful backup, and may perform custom actions, like truncating transaction logfiles.
- In this mode a Hyper-V Server would stop virtual machines running on it for a short time until the the shadow copy has been taken.
- An Exchange server will - after snapshot signals a successful backup - truncate transaction logs
- Each writer is responsible for each owns actions.
- Snapshot has no effect on the actions carried out by the writers.
  A detailed control of the Writers is possible by using the command line, for example if you already have a dedicated Exchange backup feature and do not want that snapshot triggers the deletion of the transaction logs:
  - --AllWriters: With this option, use the Volume Shadow Copy Service snapshot in a mode that notifies all involved applications explicitly about the process of the backup.
    The writer then have the opportunity to perform before and after the backup necessary actions.
    A Hyper-V server running virtual machines with virtual machines notified of impending backup.
    Virtual machines on which no integration services are installed, are stopped short of creating the shadow copy.
  - --ExcludeWriter:"NameWriter1","NameWriter2","NameWriter3",...
    This options sets implicit --AllWriters and excludes the list of specified writers.
  - --IncludeWriter:"NameWriter1","NameWriter2","NameWriter3",...
    Using this option only the specified writer will be notified.

  Copyright © 2001-2016 Tom Ehlert Software